﻿using DFGK_WMS.Model.DTO;
using DFGK_WMS.Model.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static NPOI.HSSF.Util.HSSFColor;

namespace DFGK_WMS.IRepository
{
    /// <summary>
    /// 出库表管理
    /// </summary>
    public interface ITShippingOrderDetailRepository : IBaseRepository<TShippingOrderDetail>
    {

        /// <summary>
        /// 添加出库管理 多个物料版本
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        bool AddTShippingOrderDetailPlus(TShippingOrderDetailPlusDTO model, out string msg);

        /// <summary>
        /// 删除出库管理
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        bool DeleteTShippingOrderDetail(string OrderSn,out string errorMsg);

        /// <summary>
        /// 修改出库管理  多个物料版本
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        bool UpdateTshippingOrderDetailPlus(TShippingOrderDetailPlusDTO models, out string errorMsg);

        /// <summary>
        /// 显示出库单 多个物料版本
        /// </summary>
        /// <param name="status"></param>
        /// <param name="warehouseid"></param>
        /// <param name="name"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<GetChukuDanDTO> GetAllTShippingOrderDetailPlus(DateTime? startTime, DateTime? endTime, int? billType, int? houseid, string? name, int pageIndex, int pageSize, out int totalCount);
        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="billType"></param>
        /// <param name="houseid"></param>
        /// <param name="name"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        List<TShippingLockCellGetDTO> GetOuHouseToExcel(DateTime? startTime, DateTime? endTime, int? billType, int? houseid, string? name, int pageIndex, int pageSize, out int totalCount);
        UpdGetOutOrder GetOneTShippingOrderDetailPlus(string orderSn);
        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        bool UpdTShippingOrderDetailState(ReceivingOrderDetailDto model);
  
        /// <summary>
        /// 根据物料id返回批次号和数量
        /// </summary>
        /// <param name="mid"></param>
        /// <returns></returns>
        BatchNoMaxCount GetMaterialIdById(int mid, string batchNO = null, int? qualityState = null, string warehouseCode = "", string areaCode = "", int? ownerId = null, int? supplierId = null, string produceFactory = "");

        /// <summary>
        /// 查看货品明细
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        List<TShippingGoodsDetail> GetOneTShippingGoodsDetail(int id, int pageIndex, int pageSize, out int totalCount);

        List<TShippingGoodsDetail> GetByNameShippingGoodsDetail(string? name, int pageIndex, int pageSize, out int totalCount);

        bool UpdateTshippingOrderDetailPlusNew(TShippingOrderDetailPlusDTO models, out string errorMsg);

        /// <summary>
        /// 出库单下传
        /// </summary>
        /// <param name="pickDetailsList"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        bool ShippingTaskDownload(List<PickDetails> pickDetailsList, out string message);

        /// <summary>
        /// 获取出库物料
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        List<ShippingSelectMaterialDto> GetInventoryByMaterialAll(int pageIndex, int pageSize,string? mname,out int count);



        /// <summary>
        /// 出库单回传
        /// </summary>
        /// <returns></returns>
        List<PickDetails> BackShippingOrder();

        /// <summary>
        /// 采购退料
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        bool AddPurchaseRetreat(PurchaseRetreatDto model, out string msg);

        /// <summary>
        /// 生产领料
        /// </summary>
        /// <param name="productionRequisitionDto"></param>
        /// <returns></returns>
        bool AddProductionRequisition(ProductionRequisitionDto model, out string msg);

        /// <summary>
        /// 销售发货
        /// </summary>
        /// <param name="productionRequisitionDto"></param>
        /// <returns></returns>
        bool AddMarketShipments(MarketShipmentsDto model, out string msg);

        /// <summary>
        /// 调用mes出库接口
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        Task<bool> PostMESShipping(MESShippingDto dto);


        /// <summary>
        /// 添加上架单
        /// </summary>
        /// <param name="putawayOrder"></param>
        /// <returns></returns>
        List<TPutawayOrder> AddPutawayOrder(out string msg,TShippingOrderDetailPlusDTO model);


        /// <summary>
        /// 添加上架单
        /// </summary>
        /// <param name="putawayOrder"></param>
        /// <returns></returns>
        List<TPutawayOrder> AddPutawayOrder(out string msg, ProductionRequisitionDto model);

        //获取上架单信息
        List<TPutawayOrder> GetPutawayOrder(out string msg, TShippingOrderDetailPlusDTO model);



        bool UpAGVPonitMessage(int taskType, string point, out string message);

        /// <summary>
        /// 生产领料出库接口
        /// </summary>
        /// <param name="path"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        MESReturnDto MESinsertBillData(string path, object data);
    }
}